package com.linewell.encryption.utils.sm2.vo;


import com.linewell.encryption.utils.Base64Utils;
import org.bouncycastle.math.ec.ECPoint;

import java.math.BigInteger;

public class SM2KeyVO {

    BigInteger privateKey;
    ECPoint publicKey;

    public BigInteger getPrivateKey() {
        return privateKey;
    }

    public void setPrivateKey(BigInteger privateKey) {
        this.privateKey = privateKey;
    }

    public ECPoint getPublicKey() {
        return publicKey;
    }

    public void setPublicKey(ECPoint publicKey) {
        this.publicKey = publicKey;
    }


    /**
     * 公钥 Base64
     * HardPubKey:3059301306072A8648CE3D020106082A811CCF5501822D03420004+X+Y
     * SoftPubKey:04+X+Y
     *
     * @return 公钥 Base64
     */
    public String getPubHexInSoft() {
        return Base64Utils.byteToBase64(publicKey.getEncoded());
    }

    /**
     * 私钥 Base64
     *
     * @return 私钥 Base64
     */
    public String getPriHexInSoft() {
        return Base64Utils.byteToBase64(privateKey.toByteArray());
    }
}
